/**
  ETFRoot project, Anyang Normal University && IMP-CAS
  \class ETFUnpacker
  \brief the abstract base class for unpacking of the raw data from Daq.
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2021-09-27
  \date 2021-09-27 last modified
  \attention
  changelog
  <table>
  <tr>  <th>Date        <th>Author      <th>Description                    </tr>
  <tr>  <td>2021-09-27   <td>Asia Sun    <td>file created                   </tr>
  </table>

  \copyright Copyright (c) 2021 Anyang Normal U. && IMP-CAS with LGPLv3 LICENSE
*/

#ifndef ETFUnpacker_h
#define ETFUnpacker_h

#include "FairUnpack.h"

class TClonesArray;

class ETFUnpacker : public FairUnpack{
public:
  /// \param type: marks the different unpackers: e.g. VME, PXI, etc.
  ETFUnpacker(Short_t type);
  virtual ~ETFUnpacker();

  virtual int GetOneEvent(FILE *file) = 0; ///< get 1 event to memory from file
  virtual int GetOneEvent(int *fstream) = 0; ///< get 1 event to memory from stream
  virtual bool Unpack() = 0; ///< complete the unpack and filling of the unpacked data
  virtual int GetCurrentEventIndex() const{ return fCurrentEventIndex; }
  virtual void PrintSummary() = 0; ///< print unpacking summary
  int GetNofProcessedEvent(){ return fEventCnt; }

  ClassDef(ETFUnpacker, 0); // virtual unpacker for ETF

protected:
  int fCurrentEventIndex; ///< index of the current event
  int fEventCnt; ///< total number of events processed
};

#endif
